﻿/*  
    This file is part of Latex2MathML.

    Latex2MathML is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Latex2MathML is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Latex2MathML.  If not, see <http://www.gnu.org/licenses/>.
*/

using System.Text;

namespace Latex2MathML
{
    /// <summary>
    /// The converter class for footnotes.
    /// </summary>
    internal sealed class FootnoteCommandConverter : CommandConverter
    {
        /// <summary>
        /// Gets the command name.
        /// </summary>
        public override string Name
        {
            get
            {
                return "footnote";
            }
        }

        /// <summary>
        /// Gets the expected count of child subtrees.
        /// </summary>
        public override int ExpectedBranchesCount
        {
            get { return 1; }
        }

        /// <summary>
        /// Performs the conversion procedure.
        /// </summary>
        /// <param name="expr">The expression to convert.</param>
        /// <returns>The conversion result.</returns>
        public override string Convert(LatexExpression expr)
        {
           if (!expr.Customization.Counters.ContainsKey("!footnote"))
           {
               expr.Customization.Counters.Add("!footnote", 1);
           }
            return "<sup id=\"backnote" + expr.Customization.Counters["footnote"] + "\" class=\"footnote\">" +
                "<a href=\"#note" + expr.Customization.Counters["footnote"]++ + "\">" +
                SequenceConverter.ConvertOutline(expr.Expressions[0], expr.Customization) + "</a></sup>";
        }
    }
    /*
    /// <summary>
    /// The converter class for \footnotetext.
    /// </summary>
    internal sealed class FootnotetextCommandConverter : CommandConverter
    {
        /// <summary>
        /// Gets the command name.
        /// </summary>
        public override string Name
        {
            get
            {
                return "footnotetext";
            }
        }

        /// <summary>
        /// Gets the expected count of child subtrees.
        /// </summary>
        public override int ExpectedBranchesCount
        {
            get { return 1; }
        }

        /// <summary>
        /// Performs the conversion procedure.
        /// </summary>
        /// <param name="expr">The expression to convert.</param>
        /// <returns>The conversion result.</returns>
        public override string Convert(LatexExpression expr)
        {
            
        }
    }

    /// <summary>
    /// The converter class for \footnotemark.
    /// </summary>
    internal sealed class FootnotemarkCommandConverter : CommandConverter
    {
        /// <summary>
        /// Gets the command name.
        /// </summary>
        public override string Name
        {
            get
            {
                return "footnotemark";
            }
        }

        /// <summary>
        /// Gets the expected count of child subtrees.
        /// </summary>
        public override int ExpectedBranchesCount
        {
            get { return 0; }
        }

        /// <summary>
        /// Performs the conversion procedure.
        /// </summary>
        /// <param name="expr">The expression to convert.</param>
        /// <returns>The conversion result.</returns>
        public override string Convert(LatexExpression expr)
        {
            if (!expr.Customization.Counters.ContainsKey("!footnote"))
            {
                expr.Customization.Counters.Add("!footnote", 1);
            }
            return "<sup id=\"backnote" + expr.Customization.Counters["footnote"] + 
                "\" class=\"footnote\"><a href=\"#note" + expr.Customization.Counters["footnote"]++ + "\">*</a></sup>";
        }
    }*/
}
